/* author: Mariana Horita
   mariana.horita@gmail.com
   file: HomeController.cs*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MvcApplicationClasses.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {   
            ViewData["Message"] = "Welcome to ASP.NET MVC!";

            return View();
        }

        public ActionResult Form()
        {
            return View();
        }

        public ActionResult About()
        {


            ViewData["alunos"] = new List<string>();

            for (int i = 1; i < 21; i++)
            {
                ((List<string>)ViewData["alunos"]).Add("Aluno " + i);
            }


            return View();
        }

        public ActionResult Confirmar(string txtNome, string txtTelefone, string txtEndereco)
        {
            ViewData["txtNome"] = txtNome;
            ViewData["txtTelefone"] = txtTelefone;
            ViewData["txtEndereco"] = txtEndereco;

            return View();
        }

        [AcceptVerbs (HttpVerbs.Post)]
        public void Validar()
        {
            if (Request.Form["ckbNome"] == "on" && Request.Form["ckbTelefone"] == "on" && Request.Form["ckbEndereco"] == "on")
            {
                Response.Redirect("/Home/Obrigado");
            }
            else
            {
                Response.Redirect("/Home/Index");
            }
        }

        public ActionResult Obrigado()
        {
            return View();
        }


        public ActionResult Home()
        {
            return View();
        }
    }
}
